#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

using namespace std;

int main()
{
    string s, src;
    int n, a, b;
    cin >> n;
    while (cin >> s >> src, n--)
    {
        if (s == "Hunter")
            a = 0;
        else if (s == "Bear")
            a = 1;
        else
            a = 2;

        if (src == "Hunter")
            b = 0;
        else if (src == "Bear")
            b = 1;
        else
            b = 2;

        if (s == src)
            puts("Tie");
        else if (a == (b + 1) % 3)
            puts("Player1");
        else
            puts("Player2");
    }
    return 0;
}
